// 导入模块函数
import { createRouter, createWebHistory } from "vue-router";

// 导入组件
import LoginVue from '@/components/Login.vue';  // 登录注册组件
import LoginVue1 from '@/components/Login1.vue';  // 登录注册组件2
import LoginVue2 from '@/components/Login2.vue';  // 登录注册组件2

import LayoutVue from '@/components/Layout.vue';    // 主页面组件
import ErrorVue from '@/components/404.vue';    // 错误页面组件

import ArticleVue from "@/components/ArticleManage.vue";     // 用户组件
import PermissionVue from "@/components/PermissionManage.vue"; // 权限组件
import UserVue from "@/components/UserManage.vue";  // 商品组件
import CommentVue from "@/components/CommentManage.vue";  // 订单组件
import UserInfoVue from "@/components/UserInfo.vue";   // 系统设置组件
import UserIwwVue from "@/components/UserInfoww.vue";  // 用户信息组件
import UserAvatarVue from "@/components/UserAvatar.vue"; // 用户头像组件
import UserPwdVue from "@/components/UserPesetPassword.vue"; // 更改密码组件
import IndexVue from "@/components/Index.vue"; // 首页页面组件
// 定义路由关系
const routes = [
    { path: '/login', component: LoginVue1 },
    { path: '/', component: IndexVue },
    {
        path: '/main', component: LayoutVue, redirect: '/articleManage', children: [
            { path: '/articleManage', component: ArticleVue },
            { path: '/permissionManage', component: PermissionVue },
            { path: '/userManage', component: UserVue },
            { path: '/commentManage', component: CommentVue },
            { path: '/userInfoManage', component: UserInfoVue },
            { path: '/userAvatar', component: UserAvatarVue },
            { path: '/userPwd', component: UserPwdVue },
            { path: '/userInfoww', component: UserIwwVue }
        ],
    },
    { path: '/404', component: ErrorVue }
]
// 定义路由
const router = createRouter({
    history: createWebHistory(),
    routes: routes
})

// 导入路由
export default router
